package com.xi.controller;

import com.xi.service.MainService;
import com.xi.vo.CommonResult;
import com.xi.vo.ReportVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/main")
@Tag(name = "主要模块")
@RestController
@ResponseBody
public class MainController {
    @Autowired
    MainService mainService;

    @Operation(summary = "提取词汇")
    @PostMapping("/extractKeywords")
    public CommonResult extractKeywords() {
        ReportVo reportVo = mainService.extractKeywords("We need to protect ancient monuments.");
        return CommonResult.success(reportVo);
    }

    @Operation(summary = "建立英语词典")
    @PostMapping("/buildDict")
    public CommonResult buildDict() {
        mainService.buildDict();
        return CommonResult.successObject();
    }
}
